package com.sopra.tecnica.poc.server.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.sopra.tecnica.poc.server.entity.UserEntity;
import com.sopra.tecnica.poc.server.service.UserService;

@Controller
@RequestMapping("user")
public class UserController {
	
	@Autowired
	private UserService userService;
	
	@RequestMapping("login")
	public void login(@RequestParam("code") String code,
			Model model) {
		UserEntity result = userService.login(code);
		if (result != null) {
			model.addAttribute(result);
		}
	}
}
